/**
 * @author		Sergey Suzdalskiy
 * @e-mail:		sergey.suzdalskiy@gmail.com
 */
package ua.kiev.gcore.isometry
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	
	
	public class Layers extends Sprite
	{
		private var layers:Vector.<Sprite>;
		
		public function Layers()
		{
			super();
			layers = new Vector.<Sprite>;
		}
		
		public function addLayer():int
		{
			layers.push(new Sprite());
			addChild(layers[layers.length - 1]);
			return layers.length;
		}
		
		public function addTileToLayer(object:DisplayObject, idLayer:int = 0):void{
			if(idLayer <= layers.length){
				var layer:Sprite = layers[idLayer];
				if(layer){
					layer.addChild(object);
				}
			}
		}
	}
}